
Partial Class WebForm_Main_SearchNews
    Inherits System.Web.UI.UserControl


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            RaiseEvent Loaded(Me, New EventArgs)
        End If
    End Sub

End Class

Partial Class WebForm_Main_SearchNews
    Public Sub BindGV()
        Dim sql As New MyStringBuilder
        Dim dat As New clsData
        dim dt as New Data.DataTable

        sql.AppendFormat("select top 7 ")
        sql.AppendFormat("left(Topic,15)+'...' as NewsSubject ")
        sql.AppendFormat(",Href as NewsID ")
        sql.AppendFormat(",* from News ")

        dt = dat.GetData(sql.ToString())

        If dt.rows.count > 0 Then
            Me.lblTopOne.Text = dt.Rows(0)("TheContent").ToString()

            If Me.lblTopOne.Text.Length > 750 Then
                If Me.lblTopOne.Text.IndexOf("messageWindow") <> -1 Then
                    Me.lblTopOne.Text = Me.lblTopOne.Text.Substring(0, 750) & "..."
                Else
                    Me.lblTopOne.Text = Me.lblTopOne.Text.Substring(0, 200) & "..."
                End If
            ElseIf Me.lblTopOne.Text.Length > 200 Then
                Me.lblTopOne.Text = Me.lblTopOne.Text.Substring(0, 200) & "..."
            End If
            Me.hlinkNews.NavigateUrl = dt.Rows(0)("NewsID")
            dt.Rows.RemoveAt(0)
        End If

        Me.dlNews.DataSource = dt
        Me.dlNews.DataBind()
    End Sub

    Public Event Loaded(ByVal source As Object, ByVal e As EventArgs)
End Class